package tornadoj.web;

import java.util.HashMap;
import java.util.Map;

/**
 * 静态对象池
 * Created by tinyms on 14-2-19.
 */

public class Registry {
    private static Registry self = new Registry();
    private Map<String, Object> pool = new HashMap<String, Object>();

    public static Registry self() {
        return self;
    }

    public void put(String path, Object o) {
        if(!this.exists(path)){
            this.pool.put(path, o);
        }
    }

    public boolean exists(String path){
        if(this.pool.containsKey(path)){
            return true;
        }
        return false;
    }

    public Object get(String path) {
        return this.pool.get(path);
    }

    public void clear(){
        this.pool.clear();
    }
}
